import string
import random

class Queue(object):
    def __init__(self):
        self.__list=[]

    def is_empty(self):
        return self.__list==[]

    def size(self):
        return len(self.__list)

    def enqueue(self,d):
        self.__list.append(d)

    def pop(self):
        return self.__list.pop(0)
# 41  每隔 7次去除掉这个人， 输出只剩一个人的编号
names = [random.choice(string.ascii_uppercase)+random.choice(string.ascii_lowercase) for i in range(41)]
print(names)

def q(names,n):
    queue=Queue()

    for name in names:
        queue.enqueue(name)

    while queue.size()>1:
        for i in range(n):
            queue.enqueue(queue.pop())
        queue.pop()
    return queue.pop()

r=q(names, 3)
print(names.index(r), r)








